import javax.swing.*;
import java.awt.*;
    public class windows {
        public static int windows ;{
            JFrame jf = new JFrame("测试窗口");
            jf.setSize(400, 450);
            jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            jf.setLocationRelativeTo(null);

            // 创建内容面板，指定使用 流式布局
            JPanel panel = new JPanel(new FlowLayout());

            JButton btn01 = new JButton("开始游戏");
            JButton btn02 = new JButton("人机对战");
            JButton btn03 = new JButton("查看成绩");
            JButton btn04 = new JButton("退出游戏");

            panel.add(btn01);
            panel.add(btn02);
            panel.add(btn03);
            panel.add(btn04);
            jf.setContentPane(panel);
            jf.setVisible(true);        // PS: 最后再设置为可显示(绘制), 所有添加的组件才会显示
        }

    }
